package com.example.bgmachine.bgmachine.databases;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDatabaseInfor extends SQLiteOpenHelper {
    public MyDatabaseInfor(Context context) {
        super(context, "ordertable.db", null, 1);
    }
    /**
     * 当数据库第一次调用时
     * 特别适合做表结构的初始化
     * @param sqLiteDatabase
     */
    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {

        //版本注册号
        sqLiteDatabase.execSQL("create table devicerigister( verNumber integer primary key ,versions varchar(160)  )");

        sqLiteDatabase.execSQL("create table speedcheacktb( pin integer primary key ,speed float DEFAULT 1 ,time float DEFAULT 0  )");
        sqLiteDatabase.execSQL("create table capacitytb( pin integer primary key ,surplus integer DEFAULT 0 ,capacity integer DEFAULT 0  )");
        sqLiteDatabase.execSQL("create table pininfor( pin integer primary key ,reala integer DEFAULT 0  )");

        sqLiteDatabase.execSQL("create table salesouts( ordernums varchar(500) primary key ,salesvolumeOrderTime  varchar(300) ,secondMenuid  varchar(300)  , cupTypeid varchar(300) , contents text )");
        sqLiteDatabase.execSQL("create table cleartimea( ordernums varchar(500) primary key , cleantimename varchar(300) , begin_time varchar(300), theoretical_time varchar(300)  )");
        sqLiteDatabase.execSQL("create table cleartimeb( ordernums varchar(500) primary key , cleantimename varchar(300) , begin_time varchar(300), theoretical_time varchar(300)  , over_time varchar(300) )");

//        sqLiteDatabase.execSQL("create table salesouts( ordernums varchar(500) primary key ,secondnames  varchar(300) ,devicenums varchar(300) , typenames varchar(300) , contents text )");
//        sqLiteDatabase.execSQL("create table cleartimes( ordernums varchar(500) primary key , devicenums varchar(300) , cleartime varchar(300)  )");


        //更新状态校验 speed-流速
        sqLiteDatabase.execSQL("create table outmaterials( ids INTEGER PRIMARY KEY AUTOINCREMENT, menuType integer   ,pin integer  ,weighs int  ,speed float DEFAULT 1 ,times int DEFAULT 0 ,nums integer  DEFAULT 0 )");
        sqLiteDatabase.execSQL("create table menumaterials( ids INTEGER PRIMARY KEY AUTOINCREMENT,sendMeus integer  , menuType integer   ,nums integer  DEFAULT 0 )");

    }

    /**
     * 用于数据库更新
     * @param sqLiteDatabase
     * @param i
     * @param i1
     */
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
